// Nama			: Bagus Rahman Aryabima
// NIM			: 13509044
// Nama File	: Superblock.c
// Tanggal		: 3 Desember 2011
// Deskripsi	: Representasi Superblock pada 56FS

#include "Superblock.h"

// ********** Program Utama **********

int main() {
	Superblock S;
	char *MYName1, *MYName2;
	unsigned long MYSize1, MYSize2;
	char MYStatus1, MYStatus2;
	FILE *Stream;
	Stream = fopen("FileSystem.txt", "r+");
	
	printf("********** SUPERBLOCK **********\n\n");
	Initialize(&S);
	
	
	printf("***** GET BIASA *****\n\n");
	MYName1 = getName(S);
	MYSize1 = getSize(S);
	MYStatus1 = getStatus(S);
	
	printf("%s\n", MYName1);
	printf("%lu\n", MYSize1);
	printf("%c\n", MYStatus1);

	printf("\n");
	
	printf("***** SET BIASA *****\n\n");
	setName(&S, "31FS");
	setSize(&S, 4321);
	setStatus(&S);
	
	MYName1 = getName(S);
	MYSize1 = getSize(S);
	MYStatus1 = getStatus(S);
	
	printf("%s\n", MYName1);
	printf("%lu\n", MYSize1);
	printf("%c\n", MYStatus1);
	
	printf("\n");
	
	printf("***** GET KE HARD DRIVE *****\n\n");
	MYName2 = readName(Stream);
	MYSize2 = readSize(Stream);
	MYStatus2 = readStatus(Stream);

	printf("%s\n", MYName2);
	printf("%lu\n", MYSize2);
	printf("%c\n", MYStatus2);
	
	printf("\n");
	
	printf("***** SET KE HARD DRIVE *****\n\n");
	writeName(Stream, "31FS");
	writeSize(Stream, 12345678);
	writeStatus(Stream, '0');
	
	MYName2 = readName(Stream);
	MYSize2 = readSize(Stream);
	MYStatus2 = readStatus(Stream);

	printf("%s\n", MYName2);
	printf("%lu\n", MYSize2);
	printf("%c\n", MYStatus2);
	
	return 0;
}
